/***********************************************************************
 *  Project：LinkListTest.c
 *  Function:
 *  Description: LinkListTest.c 说明头指针
 *  PROJECT_FILENAME: dataStruct.cbp 选择此文件打开已创建项目
 *  Author: coder-itl
 ***********************************************************************
 *  Copyright 2021-10-04-22.58.55 by coder-itl
 ***********************************************************************/

#include "stdio.h"
#include "stdlib.h"

typedef struct monster {
    /* 怪物编号 */
    int id;
    /* 怪物名称 */
    char *name;

    /* 指向下一节点的指针 */
    struct monster *pNext;
} Monster;

void test() {
    Monster monster1 = {1, "唐三"};
    Monster monster2 = {2, "小舞"};
    Monster monster3 = {3, "小奥"};
    Monster monster4 = {4, "戴老大"};
    Monster monster5 = {5, "竹竹青"};
    Monster monster6 = {6, "马红俊"};
    Monster monster7 = {7, "胡烈娜"};

    /* 第一个元素的下一节点指向 monster2 的地址 */
    monster1.pNext = &monster2;
    monster2.pNext = &monster3;
    monster3.pNext = &monster4;
    monster4.pNext = &monster5;
    monster5.pNext = &monster6;
    monster6.pNext = &monster7;

    monster7.pNext = NULL;

}
